/**
 * 登陆相关mixin
 * @author michaelZ
 */
import { Component, Vue } from 'vue-property-decorator';

@Component
export default class loginMixin extends Vue {
  public onLoad(param?: any | {}) {
    console.log(param);

    // 判断是否已登录
    let userInfo = wx.getStorageSync('user-info');

    if (!userInfo) {
      wx.redirectTo({
        url: '/pages/auth/index'
      }).catch();

      return;
    }

    this.$$mutations.updateUserInfo(userInfo);
  }
}
